package com.nexus.plugin.mybatis.config;

import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.nexus.core.properties.ExternalPropertySourceFactory;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * MyBatis-Plus配置类
 *
 * @Date 2025/7/25 13:56
 * @Author luzhengning
 **/
@Configuration
@MapperScan("com.nexus.**.mapper")
@org.springframework.context.annotation.PropertySource(
        name = "mybatis.properties",
        value = "classpath*:mybatis-pro.properties",encoding = "UTF8",
        factory = ExternalPropertySourceFactory.class,
        ignoreResourceNotFound = true
)
public class MyBatisPlusConfig {
    /**
     * 全局配置
     *
     * @Date 2025/7/25 13:58
     * @Author luzhengning
     **/
    @Bean
    public GlobalConfig globalConfig() {
        GlobalConfig globalConfig = new GlobalConfig();
        globalConfig.setDbConfig(new GlobalConfig.DbConfig().setLogicDeleteValue("1") // 逻辑删除值（数据库存储值）
                .setLogicNotDeleteValue("0") // 逻辑未删除值
        );
        return globalConfig;
    }

}
